from django.shortcuts import render
from django.db.models import Q
from rest_framework.generics import ListAPIView
from .models import BannerInfo, NavInfo
from .serializers import BannerInfoSerializer, NavInfoSerializer


# Create your views here.
class BannerInfoListAPIView(ListAPIView):
    queryset = BannerInfo.objects.filter(Q(is_show=True) & Q(is_delete=False)).order_by('orders')
    serializer_class = BannerInfoSerializer


class NavInfoAPIView(ListAPIView):
    queryset = NavInfo.objects.filter(Q(is_show=True) & Q(is_delete=False) & Q(opt=0)).order_by('orders')
    serializer_class = NavInfoSerializer


class NavInfoFooterAPIView(ListAPIView):
    queryset = NavInfo.objects.filter(Q(is_show=True) & Q(is_delete=False) & Q(opt=1)).order_by('orders')
    serializer_class = NavInfoSerializer
